1 Setup

1.1 Importing

library(broom);
library(equatiomatic);
library(ggrepel);
library(janitor);
library(knitr);
library(magrittr);
library(naniar);
library(patchwork);
library(rstanarm);
library(tidyverse);
library("readxl");
library(ggforce);
library(rstatix);
theme_set(theme_bw())

1.2 Reading Data

Read the data from the three different sections: basic subject data, threshold data, and sensory Threshold data.

subjectRawData <- read_excel("RawData.xlsx", sheet=1) %>%
  clean_names();
stimRawData <- read_excel("RawData.xlsx", sheet=2) %>%
  clean_names();
pitRawData <- read_excel("RawData.xlsx", sheet=3) %>%
  clean_names();

2 Hypothesis

Stimulating using electrodes located in the palm and fingers can generate a distal sensation while limiting the sensation to the targeted finger.

Increasing stimulation intensity produces a more distal sensation and increases area of the sensation.

Increasing the surface area of the return electrode and placing it at a distant location from the active electrode will mitigate return electrode sensation and help bound the sensation the targeted finger.

3 Electrode Locations and Acronim Reference

3.1 Acronyms

Return Electrodes:

Elb-Elbow  

PA1-Palm’s Anterior Face Electrode 1/3*  

PP1-Palm’s Posterior Face Electrode 1/3*  

  • The x/3 represents whihc of the thre electrode in each side of the palm it is. In the exploratory trials all three electrodes where evaluated, but the electrode closest (1) to the index performed better. Due to their better performance, only the first out of the three electrodes in each face of the palm were evaluated.

 

Active Electrode:

PL-Proximal Phalange’s Lateral Face Electrode  

IL-Intermediate Phalange’s Lateral Face Electrode  

IA-Intermediate Phalange’s Anterior Face Electrode  

3.2 Location of the Electrodes

 

4 Exploratory Data Analysis

The following sections are just plots of data created to better understand the data and its trends.

4.1 All Data

Tables of each of the sections mentioned above

subjectRawData
stimRawData
pitRawData

4.2 Basic Subject Data

Shows subject demographics summary.

ageData <- subjectRawData %>% select(age);
summary(ageData)
##       age       
##  Min.   :21.00  
##  1st Qu.:22.00  
##  Median :27.00  
##  Mean   :30.45  
##  3rd Qu.:31.50  
##  Max.   :72.00  
##  NA's   :1
sexData <- subjectRawData %>% select(sex);
sexData %>% filter(complete.cases(sex)) %>%
    ggplot(data = ., aes(x = sex)) +
    geom_bar(show.legend = TRUE)+
    labs(title = "Sex at Birth Distribution",
         y = "Number of Subjects",
         x = "Sex at Birth") 

    #theme_classic()

4.3 Analysis of Sensation Location

4.3.1 Do Higher Stimualtion Parameters Elicit a more Distal Sensation?

centroidData <- read_csv("centroid_data.csv")%>%
  clean_names() %>% 
  mutate(location = factor(location)) %>%
  mutate(subject = factor(subject)) %>%
  #filter(subject %in% c("01", "02", "03", "04", "10", "11", "12")) %>%
  mutate(temp1 = case_when(
        strenght == 2 ~ "Maximum Comfortable",
        strenght == 1 ~ "Perception Threshold"),
        strenghtCAT = factor(temp1)) %>%
  mutate(temp2 = case_when(
        location == 1 ~ "PL|PA1",
        location == 2 ~ "IL|PA1",
        location == 3 ~ "IA|PA1",
        location == 4 ~ "PL|Elb",
        location == 5 ~ "IL|Elb",
        location == 6 ~ "IA|Elb",
        location == 7 ~ "PL|PP1",
        location == 8 ~ "IL|PP1",
        location == 9 ~ "IA|PP1"),
        locationCAT = factor(temp2)) %>%
  mutate(temp3 = case_when(
        location == 1 ~ "PL",
        location == 2 ~ "IL",
        location == 3 ~ "IA",
        location == 4 ~ "PL",
        location == 5 ~ "IL",
        location == 6 ~ "IA",
        location == 7 ~ "PL",
        location == 8 ~ "IL",
        location == 9 ~ "IA"),
        ActiveElectrode = factor(temp3)) %>%
  mutate(temp4 = case_when(
        location == 1 ~ "PA1",
        location == 2 ~ "PA1",
        location == 3 ~ "PA1",
        location == 4 ~ "Elb",
        location == 5 ~ "Elb",
        location == 6 ~ "Elb",
        location == 7 ~ "PP1",
        location == 8 ~ "PP1",
        location == 9 ~ "PP1"),
        ReturnElectrode = factor(temp4)) %>%
  mutate(temp5 = case_when(
        max >= 80 ~ 1,
        max < 80 ~ 0),
        distal = temp5) %>%
  mutate(temp6 =strenght*distal,
    distalByStrenght = temp6)%>%
  select(locationCAT, strenghtCAT, centroid, subject, ReturnElectrode, ActiveElectrode, min, max, distal,distalByStrenght);
  centroidData
  centroidData.summary <- centroidData %>%
    group_by(locationCAT, strenghtCAT) %>%
    summarise (
      aveMin= mean(min/55),
      aveMax = mean(max/55),
      aveCentroid = mean(centroid/55),
      circR= (aveMax-aveMin)/2,
      circC= aveMin+circR,
      sd = sd(centroid/55)
    )
  
  centroidData.summaryD <- centroidData %>%
    group_by(locationCAT, subject) %>%
    summarise (
      distalSum= sum(distal),
      distalSumBS= sum(distalByStrenght)) %>%
    mutate(temp1 = case_when(
        distalSum == 0 ~ "None",
        distalSum == 1 ~ "Either",
        distalSum == 2 ~ "Both"),
        distalCAT = factor(temp1)) %>%
    mutate(temp2 = case_when(
        distalSumBS == 0 ~ "None",
        distalSumBS == 1 ~ "Perception",
        distalSumBS == 2 ~ "Maximum",
        distalSumBS == 3 ~ "Both"),
        distalBySCAT = factor(temp2))
  # centroidData %>%
  #   ggplot() +
  #   geom_linerange(data = centroidData.summary, mapping = aes(x=locationCAT, ymin= aveMin, ymax=aveMax, color = factor(strenghtCAT, levels =c('Threshold', 'Maximum Comfortable'))),  position = position_dodge(width=1), size =4)+
  #   geom_linerange(data = centroidData.summary, mapping = aes(x=locationCAT, ymin= aveCentroid-0.01, ymax=aveCentroid+0.01, group= factor(strenghtCAT, levels =c('Threshold', 'Maximum Comfortable'))),position =position_dodge(width=1), size =4)+
  #   labs(title = "Vertical Centroid and Envelope of all Sensations for All Electrode Combinations",
  #        y = "Sensation Location (phalanges)",
  #        x = "Electrode Locations",
  #        #caption = "0px is center of proximal phalange",
  #        color = "Strenght") +
  #   scale_color_manual(values = c("#4C46FF", "#FF3939"))+
  #   theme_classic();
  #c(1,25, 0.75, 2.25, 1.75, 3.25, 2.75, 4.25, 3.75, 5.25, 4.75, 6.25, 5.75, 7.25, 6.75, 8.25, 7.75, 9.25, 8.75)
  
  centroidData.summary <- centroidData %>%
    group_by(locationCAT, strenghtCAT) %>%
    summarise (
      Proximal= mean(min/55),
      Distal = mean(max/55),
      VerticalCentroid = mean(centroid/55),
      ProximalSD=sd(min/55),
      DistalSD = sd(max/55),
      VerticalCentroidSD = sd(centroid/55)
    )
    centroidData.summary <- centroidData.summary %>%
      pivot_longer(Proximal:VerticalCentroid, names_to="metric", values_to="sensation_location") %>%
      mutate(metric = factor(metric)) %>%
      pivot_longer(ProximalSD:VerticalCentroidSD, names_to="metricSD", values_to="sensation_locationSD") %>%
      mutate(metricSD = factor(metricSD))
    centroidData.prox <- subset(centroidData.summary, metric=="Proximal" & metricSD=="ProximalSD")
    centroidData.cent <- subset(centroidData.summary, metric=="VerticalCentroid" & metricSD=="VerticalCentroidSD")
    centroidData.dist <- subset(centroidData.summary, metric=="Distal" & metricSD=="DistalSD")
    centroidData.summary <- rbind(centroidData.prox, centroidData.cent, centroidData.dist)
    
    centroidData.summary %>%
    ggplot(data = centroidData.summary, mapping = aes(x=locationCAT, y=sensation_location, fill = factor(strenghtCAT, levels =c('Perception Threshold', 'Maximum Comfortable')), shape = factor(metric, level=c("Distal", "VerticalCentroid","Proximal")))) +
    geom_point(position =position_dodge(width=0.5), size = 3)+
      geom_errorbar(mapping =aes(ymin=sensation_location-sensation_locationSD, ymax=sensation_location+sensation_locationSD, color = factor(strenghtCAT, levels =c('Perception Threshold', 'Maximum Comfortable'))), width =0.4, position =position_dodge(width=0.5))+
    geom_segment(x=0, y=1, xend=6.49, yend=1, size= 0.7, color = "#EBA134")+
    geom_segment(x=6.51, y=0, xend=9.8, yend=0, size= 0.7, color = "#EBA134")+
    geom_vline(xintercept= 1.5, size=0.5)+
    geom_vline(xintercept= 2.5, size=0.5)+
    geom_vline(xintercept= 3.5, size=0.5)+
      geom_vline(xintercept= 4.5, size=0.5)+
      geom_vline(xintercept= 5.5, size=0.5)+
      geom_vline(xintercept= 6.5, size=0.5)+
      geom_vline(xintercept= 7.5, size=0.5)+
      geom_vline(xintercept= 8.5, size=0.5)+
    labs(title = "Average Metrics of the Sensations for All Electrodes and Subjects",
         y = "Sensation Location (phalanges)",
         x = "Electrode Combinations") +
      ylim(-1.9,2.9)+
    scale_fill_manual(name="Pulse Width",
        breaks=c("Perception Threshold", "Maximum Comfortable", "Active Electrode"),
        values = c("Perception Threshold" = "#4C46FF", "Maximum Comfortable"="#FF3939",  "Active Electrode"="#EBA134"))+
      scale_color_manual(name="Pulse Width",
        breaks=c("Perception Threshold", "Maximum Comfortable", "Active Electrode"),
        values = c("Perception Threshold" = "#4C46FF", "Maximum Comfortable"="#FF3939",  "Active Electrode"="#EBA134"))+
    scale_shape_manual(name="Metric", breaks=c("VerticalCentroid", "Distal", "Proximal"),
        values = c("VerticalCentroid"=21, "Distal" = 25, "Proximal"=24))+
      #annotate(geom="text", x=5.5, y=1.09, label="Active", color="#EBA134")+
      #annotate(geom="text", x=5.5, y=0.93, label="Electrode", color="#EBA134")+
      #guides(fill = guide_legend(override.aes = list(shape = 21)))+
      guides(fill = guide_legend(override.aes = list(shape = 21)), shape = "none")+
      theme(legend.position = "bottom")

  ggsave("All_Envelopes.png")
    
    centroidData.summaryS <- centroidData %>%
      filter(subject=="4") %>%
    group_by(locationCAT, strenghtCAT) %>%
    summarise (
      Proximal= mean(min/55),
      Distal = mean(max/55),
      VerticalCentroid = mean(centroid/55)
    )
    centroidData.summarySS <- centroidData.summaryS %>%
      pivot_longer(Proximal:VerticalCentroid, names_to="metric", values_to="sensation_location") %>%
      mutate(metric = factor(metric))

    centroidData.summarySS %>%
    ggplot() +
    geom_point(data = centroidData.summarySS, mapping = aes(x=locationCAT, y=sensation_location, fill = factor(strenghtCAT, levels =c('Perception Threshold', 'Maximum Comfortable')), shape = factor(metric, level=c("Distal", "VerticalCentroid","Proximal"))), position =position_dodge2(w=0.5), size =2)+
    geom_segment(x=0, y=1, xend=6.49, yend=1, size= 0.7, color = "#EBA134")+
    geom_segment(x=6.51, y=0, xend=9.8, yend=0, size= 0.7, color = "#EBA134")+
     geom_vline(xintercept= 1.5, size=0.5)+
    geom_vline(xintercept= 2.5, size=0.5)+
    geom_vline(xintercept= 3.5, size=0.5)+
      geom_vline(xintercept= 4.5, size=0.5)+
      geom_vline(xintercept= 5.5, size=0.5)+
      geom_vline(xintercept= 6.5, size=0.5)+
      geom_vline(xintercept= 7.5, size=0.5)+
      geom_vline(xintercept= 8.5, size=0.5)+
    labs(title = "Metrics of one Subject's Sensations for All Electrodes",
         y = "Sensation Location (phalanges)",
         x = "Electrode Combinations") +
      ylim(-1.9,2.9)+
    scale_fill_manual(name="Pulse Width",
        breaks=c("Perception Threshold", "Maximum Comfortable"),
        values = c("Perception Threshold" = "#4C46FF", "Maximum Comfortable"="#FF3939"))+
    scale_shape_manual(name="Metric", breaks=c("VerticalCentroid", "Distal", "Proximal"),
        values = c("VerticalCentroid"=21, "Distal" = 25, "Proximal"=24))+
      #annotate(geom="text", x=5.5, y=1.09, label="Active", color="#EBA134")+
      #annotate(geom="text", x=5.5, y=0.93, label="Electrode", color="#EBA134")+
      guides(fill = "none")+
      theme(legend.position = "bottom")

    ggsave("S4_Envelopes.png")
    
  centroidData %>%
    ggplot() +
    geom_tile(data = centroidData.summaryD, mapping = aes(x=locationCAT, y=subject, fill= distalBySCAT))+
      labs(title = "Sensations with Distal Aspects at Perception Threshold, \n Maximum Comfortable Limit, or Both.",
         y = "Subjects",
         x = "Electrode Locations",
         fill = "Distal aspect at")+
      scale_fill_manual(name="Distal Aspects at",
        breaks=c("None", "Perception", "Maximum", "Both"),
        values = c("None" = "#ffffff", "Perception"="#4C46FF", "Maximum" = "#FF3939","Both" = "#8fe3a5"))

  ggsave("distal_sens_subj.png")

From Threshold to maximum comfortable threshold, the average vertical centroid becomes more proximal, the envelope expands, and the average proximal and distal envelope boundaries become more proximal and distal respectively across all locations.

 

4.3.1.1 Does Sensation Become more Distal as Stimualtion Strenght is Increased?

Vertical Centroid (in average)

minSel <- centroidData %>% filter(strenghtCAT == "Perception Threshold") %>% select(centroid);
maxSel <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable") %>% select(centroid);
minAll <- centroidData %>% filter(strenghtCAT == "Perception Threshold");
maxAll <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable");
mean(minSel$centroid)
## [1] 46.76415
sd(minSel$centroid)
## [1] 47.0883
mean(maxSel$centroid)
## [1] 33.08625
sd(maxSel$centroid)
## [1] 33.16355
centroidData %$% t.test(centroid ~ strenghtCAT, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  centroid by strenghtCAT
## t = -3.1059, df = 98, p-value = 0.002482
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -22.417320  -4.938487
## sample estimates:
## mean of the differences 
##                -13.6779
wilcox.test(centroid ~ strenghtCAT,data = centroidData,paired = TRUE,alternative = "less")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  centroid by strenghtCAT
## V = 1682, p-value = 0.002837
## alternative hypothesis: true location shift is less than 0

  Most Distal Sensation

minSel <- centroidData %>% filter(strenghtCAT == "Perception Threshold") %>% select(max);
maxSel <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable") %>% select(max);
mean(minSel$max)
## [1] 81.71717
sd(minSel$max)
## [1] 39.43246
mean(maxSel$max)
## [1] 105.0303
sd(maxSel$max)
## [1] 38.92207
centroidData %$% t.test(max ~ strenghtCAT, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  max by strenghtCAT
## t = 5.4931, df = 98, p-value = 3.12e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  14.89083 31.73544
## sample estimates:
## mean of the differences 
##                23.31313
wilcox.test(max ~ strenghtCAT,data = centroidData,paired = TRUE,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  max by strenghtCAT
## V = 3761, p-value = 8.228e-08
## alternative hypothesis: true location shift is greater than 0

The 95% confidence interval of the paired t-test comparing average vertical centroid does not cross zero (-22.41, -4.93), so the average vertical centroid for the Threshold threshold is statistically greater than the maximum comfortable threshold average vertical centroid. The 95% confidence interval of the paired t-test comparing average distal envelope bound does not cross zero (14.89, 31.73), so the Threshold threshold’s average distal envelope bound is statistically less than the distal envelope bound for the maximum comfortable threshold. From the t-test and the graphs, the sensation on average becomes more proximal as stimulation strength is increased, but the distal boundary of the envelop becomes more distal as stimulation strength increases.
 

4.3.1.2 Clinically Significant Difference in Most Distal Sensation Between Threshold Threshold and Maximum Comfortable Threshold

diff = maxSel-minSel
total <- nrow(diff)
diff <- diff %>% filter(diff >= 50)
sig <- nrow(diff)

Number of observations with a change in the distal envelop boundary as stimualtion increases of at least one phalange.

Total Observations: 99

Significant Observations: 25

Percentage: 25.2525252525253%

25% of the observations became more distal by at least one phalange.

 

4.3.1.3 How Many More Subjects had Clinically Significant Distal Sensations When Comparing Sensation Locations at Threshold Threshold and Maximum Comfortable Threshold

minAll75 <- minAll %>% filter(max >= 75)
sigMin <- nrow(minAll75)
maxAll75 <- maxAll %>% filter(max >= 75)
sigMax <- nrow(maxAll75)

Number of observations with a sensation in the distal phalange at the Threshold threshold and the maximum comfortable threshold

Threshold threshold clinically significant trials: 61

Maximum comfortable threshold clinically significant trials: 78

Difference:17

78.7% of the trials reported a sensation in the distal phalange at maximum comfortable threshold compared to 61.6% at Threshold threshold (17.1% more).

 

Table with clinically significant observations for Threshold threshold

minAll75

 

Table with clinically significant observations For maximum comfortable threshold

maxAll75

Subjects with clinically significant observations at Threshold threshold: 2,3,4,5,6,8,9,10,11,12

Subjects with clinically significant observations at maximum comfortable threshold: 1,2,3,4,5,6,8,9,10,11,12

Difference:1

At maximum comfortable threshold, all subjects reported a sensation on the distal phalange in at least one of the electrode combinations.

 

4.3.1.4 Does the Sensation Envelop Size Increase as Stimulation Strenght in Increased?

mean(minAll$max-minAll$min)
## [1] 69.93939
sd(minAll$max-minAll$min)
## [1] 46.39533
mean(maxAll$max-maxAll$min)
## [1] 142.3838
sd(maxAll$max-maxAll$min)
## [1] 48.90948
centroidData %$% t.test(max-min ~ strenghtCAT, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  max - min by strenghtCAT
## t = 11.741, df = 98, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  60.19949 84.68940
## sample estimates:
## mean of the differences 
##                72.44444
wilcox.test(max-min ~ strenghtCAT,data = centroidData,paired = TRUE,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  max - min by strenghtCAT
## V = 4707, p-value = 3.384e-15
## alternative hypothesis: true location shift is greater than 0

With statistical significance, the envelop size increased as stimulation strength increased by an average of 72px or 1.44 phalanges.

  Normality test centroid

p1 <- ggplot(centroidData, aes(x = centroid)) +
    geom_histogram(fill = "slateblue", col = "white", 
                   binwidth = 1) + 
    labs(x = "Centroid") +
    theme_bw()

p2 <- ggplot(centroidData, aes(sample = centroid)) +
    geom_qq(col = "slateblue") + geom_qq_line(col = "red") + 
    labs(y = "Centroid") +
    theme_bw()

p3 <- ggplot(centroidData, aes(x = "", y = centroid)) +
    geom_violin() + 
    geom_boxplot(fill = "slateblue", width = 0.3, notch = TRUE) + 
    labs(y = "Centroid",
         x = "") +
    theme_bw() + 
    coord_flip()

p1 + p2 - p3 +
  plot_layout(ncol = 1, height = c(3, 2))

### Is There A Statistically Significant Difference In the Vertical Centroid and Envelope of the Sensation Across Different Electrode Locations?

Two way anova of max sensation threshold average vertical centroid

two.way <- aov(centroid ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value Pr(>F)
## ActiveElectrode                  2   1386   693.0   0.611  0.545
## ReturnElectrode                  2   2003  1001.6   0.883  0.417
## ActiveElectrode:ReturnElectrode  4   2342   585.4   0.516  0.724
## Residuals                       90 102051  1133.9
maxFried <- aggregate(centroid ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(centroid ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  centroid and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 0.66667, df = 2, p-value = 0.7165

Two way anova of min sensation threshold average vertical centroid

two.wayMin <- aov(centroid ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  15516    7758   3.530 0.0334 *
## ReturnElectrode                  2    742     371   0.169 0.8449  
## ActiveElectrode:ReturnElectrode  4   3247     812   0.369 0.8299  
## Residuals                       90 197790    2198                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(centroid ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(centroid ~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  centroid and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of max sensation threshold average most distal sensation

two.way <- aov(max ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2   8164    4082   2.708 0.0721 .
## ReturnElectrode                  2   1208     604   0.401 0.6711  
## ActiveElectrode:ReturnElectrode  4   3412     853   0.566 0.6880  
## Residuals                       90 135679    1508                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(max ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(max ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  max and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of min sensation threshold average most distal sensation

two.wayMin <- aov(max ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  11373    5686   3.692 0.0288 *
## ReturnElectrode                  2    272     136   0.088 0.9155  
## ActiveElectrode:ReturnElectrode  4   2135     534   0.347 0.8458  
## Residuals                       90 138603    1540                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(max ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(max ~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  max and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 6, df = 2, p-value = 0.04979

Tukey test to compare active and return electrode categories in min sensation threshold

TukeyHSD(two.wayMin)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = max ~ ActiveElectrode * ReturnElectrode, data = minAll)
## 
## $ActiveElectrode
##             diff       lwr       upr     p adj
## IL-IA  -9.848485 -32.87164 13.174673 0.5666121
## PL-IA -26.000000 -49.02316 -2.976843 0.0228753
## PL-IL -16.151515 -39.17467  6.871642 0.2216232
## 
## $ReturnElectrode
##              diff       lwr      upr     p adj
## PA1-Elb  4.060606 -18.96255 27.08376 0.9073243
## PP1-Elb  2.000000 -21.02316 25.02316 0.9766572
## PP1-PA1 -2.060606 -25.08376 20.96255 0.9752395
## 
## $`ActiveElectrode:ReturnElectrode`
##                        diff       lwr      upr     p adj
## IL:Elb-IA:Elb -1.054545e+01 -63.73348 42.64257 0.9993827
## PL:Elb-IA:Elb -1.272727e+01 -65.91530 40.46075 0.9976177
## IA:PA1-IA:Elb  9.545455e+00 -43.64257 62.73348 0.9997041
## IL:PA1-IA:Elb -8.526513e-14 -53.18803 53.18803 1.0000000
## PL:PA1-IA:Elb -2.063636e+01 -73.82439 32.55166 0.9468535
## IA:PP1-IA:Elb  9.090909e+00 -44.09712 62.27894 0.9997944
## IL:PP1-IA:Elb -3.636364e-01 -53.55166 52.82439 1.0000000
## PL:PP1-IA:Elb -2.600000e+01 -79.18803 27.18803 0.8265705
## PL:Elb-IL:Elb -2.181818e+00 -55.36985 51.00621 1.0000000
## IA:PA1-IL:Elb  2.009091e+01 -33.09712 73.27894 0.9543759
## IL:PA1-IL:Elb  1.054545e+01 -42.64257 63.73348 0.9993827
## PL:PA1-IL:Elb -1.009091e+01 -63.27894 43.09712 0.9995534
## IA:PP1-IL:Elb  1.963636e+01 -33.55166 72.82439 0.9600423
## IL:PP1-IL:Elb  1.018182e+01 -43.00621 63.36985 0.9995229
## PL:PP1-IL:Elb -1.545455e+01 -68.64257 37.73348 0.9910389
## IA:PA1-PL:Elb  2.227273e+01 -30.91530 75.46075 0.9192491
## IL:PA1-PL:Elb  1.272727e+01 -40.46075 65.91530 0.9976177
## PL:PA1-PL:Elb -7.909091e+00 -61.09712 45.27894 0.9999282
## IA:PP1-PL:Elb  2.181818e+01 -31.36985 75.00621 0.9276998
## IL:PP1-PL:Elb  1.236364e+01 -40.82439 65.55166 0.9980582
## PL:PP1-PL:Elb -1.327273e+01 -66.46075 39.91530 0.9968062
## IL:PA1-IA:PA1 -9.545455e+00 -62.73348 43.64257 0.9997041
## PL:PA1-IA:PA1 -3.018182e+01 -83.36985 23.00621 0.6796299
## IA:PP1-IA:PA1 -4.545455e-01 -53.64257 52.73348 1.0000000
## IL:PP1-IA:PA1 -9.909091e+00 -63.09712 43.27894 0.9996095
## PL:PP1-IA:PA1 -3.554545e+01 -88.73348 17.64257 0.4638396
## PL:PA1-IL:PA1 -2.063636e+01 -73.82439 32.55166 0.9468535
## IA:PP1-IL:PA1  9.090909e+00 -44.09712 62.27894 0.9997944
## IL:PP1-IL:PA1 -3.636364e-01 -53.55166 52.82439 1.0000000
## PL:PP1-IL:PA1 -2.600000e+01 -79.18803 27.18803 0.8265705
## IA:PP1-PL:PA1  2.972727e+01 -23.46075 82.91530 0.6971970
## IL:PP1-PL:PA1  2.027273e+01 -32.91530 73.46075 0.9519576
## PL:PP1-PL:PA1 -5.363636e+00 -58.55166 47.82439 0.9999964
## IL:PP1-IA:PP1 -9.454545e+00 -62.64257 43.73348 0.9997245
## PL:PP1-IA:PP1 -3.509091e+01 -88.27894 18.09712 0.4818808
## PL:PP1-IL:PP1 -2.563636e+01 -78.82439 27.55166 0.8374046

Two way anova of max sensation threshold average most proximal sensation

two.way <- aov(min ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2   2648    1324   0.748 0.4763  
## ReturnElectrode                  2   8748    4374   2.470 0.0903 .
## ActiveElectrode:ReturnElectrode  4   3630     908   0.513 0.7267  
## Residuals                       90 159374    1771                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(min ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(min ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  min and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 2.6667, df = 2, p-value = 0.2636

Two way anova of min sensation threshold average most proximal sensation

two.wayMin <- aov(min ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  27311   13656   3.789 0.0263 *
## ReturnElectrode                  2   1068     534   0.148 0.8625  
## ActiveElectrode:ReturnElectrode  4   4957    1239   0.344 0.8477  
## Residuals                       90 324391    3604                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(min ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(min~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  min and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

None of the different electrode placements show a statistically significant difference in vertical centroid or envelope. The most significant difference is when observing the proximal bound of the sensation at the maximum comfortable threshold. The difference between the palm anterior 1 and the elbow return electrode has a 95% confidence interval -50 to 0.57 pixels with a p values of 0.0567. The test confirms that the observation is not statistically significant but only by a small margin. This result combined with the plots comparing the same active electrode but different returns suggest that a bigger area elbow return electrode can successfully mitigate sensory feedback in the return electrode, and therefore, produce a envelope with a more distal proximal bound.

 

4.3.2 Can Stimulation in the Finger Generate and Distally-Reffered Sensation Location?

centroidData <- read_csv("centroid_dataRefElectrode.csv")%>%
  clean_names() %>% 
  #filter(subject %in% c("01", "02", "03", "04", "10", "11", "12")) %>%
  mutate(location = factor(location)) %>%
  mutate(temp1 = case_when(
        strenght == 2 ~ "Maximum Comfortable",
        strenght == 1 ~ "Threshold"),
        strenghtCAT = factor(temp1)) %>%
  mutate(temp2 = case_when(
        location == 1 ~ "PL|PA1",
        location == 2 ~ "IL|PA1",
        location == 3 ~ "IA|PA1",
        location == 4 ~ "PL|Elb",
        location == 5 ~ "IL|Elb",
        location == 6 ~ "IA|Elb",
        location == 7 ~ "PL|PP1",
        location == 8 ~ "IL|PP1",
        location == 9 ~ "IA|PP1"),
        locationCAT = factor(temp2)) %>%
  mutate(temp3 = case_when(
        location == 1 ~ "PL",
        location == 2 ~ "IL",
        location == 3 ~ "IA",
        location == 4 ~ "PL",
        location == 5 ~ "IL",
        location == 6 ~ "IA",
        location == 7 ~ "PL",
        location == 8 ~ "IL",
        location == 9 ~ "IA"),
        ActiveElectrode = factor(temp3)) %>%
  mutate(temp4 = case_when(
        location == 1 ~ "PA1",
        location == 2 ~ "PA1",
        location == 3 ~ "PA1",
        location == 4 ~ "Elb",
        location == 5 ~ "Elb",
        location == 6 ~ "Elb",
        location == 7 ~ "PP1",
        location == 8 ~ "PP1",
        location == 9 ~ "PP1"),
        ReturnElectrode = factor(temp4)) %>%
  select(locationCAT, strenghtCAT, centroid, subject, ReturnElectrode, ActiveElectrode, min, max);
centroidData.summary <- centroidData %>%
    group_by(locationCAT, strenghtCAT) %>%
    summarise (
      aveMin= mean(min),
      aveMax = mean(max),
      aveCentroid = mean(centroid),
    )
  centroidData %>%
    ggplot() +
    geom_linerange(data = centroidData.summary, mapping = aes(x=locationCAT, ymin= aveMin, ymax=aveMax, color = factor(strenghtCAT, levels =c('Threshold', 'Maximum Comfortable'))),  position = position_dodge(width=1), size =4)+
    geom_linerange(data = centroidData.summary, mapping = aes(x=locationCAT, ymin= aveCentroid-1, ymax=aveCentroid+1, group= factor(strenghtCAT, levels =c('Threshold', 'Maximum Comfortable'))),position =position_dodge(width=1), size =4)+
    labs(title = "Vertical Centroid and Envelope for all Sensation with the Reference \n in the Active Electrode of Each Electrode Setup",
         y = "vertical Centroid and Envelope (px)",
         x = "Location",
         caption = "0px is center of proximal phalange",
          color = "Strenght") +
    scale_color_manual(values = c("#4C46FF", "#FF3939"))+
    theme_classic();

The graph shows the Threshold threshold having a more distal average vertical centroid, more proximal distal envelop bound, and a smaller envelope when compared to the maximum comfortable sensation threshold. Also, it appears electrode configurations with an active electrode in the proximal phalange have more distal sensations than the ones with active electrodes in the intermediate phalange.

minSel <- centroidData %>% filter(strenghtCAT == "Threshold") %>% select(centroid);
maxSel <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable") %>% select(centroid);
minAll <- centroidData %>% filter(strenghtCAT == "Threshold");
maxAll <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable");

 

Average sensation for Threshold threshold

minAll %$% t.test(centroid, conf.level = 0.95)
## 
##  One Sample t-test
## 
## data:  centroid
## t = 2.1119, df = 98, p-value = 0.03724
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##   0.6093612 19.5856153
## sample estimates:
## mean of x 
##  10.09749
wilcox.test(minAll$centroid, data = minAll,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  minAll$centroid
## V = 3092, p-value = 0.01571
## alternative hypothesis: true location is greater than 0

 

Average sensation for maximum comfortable threshold

maxAll %$% t.test(centroid, conf.level = 0.95)
## 
##  One Sample t-test
## 
## data:  centroid
## t = -0.88303, df = 98, p-value = 0.3794
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  -11.62678   4.46595
## sample estimates:
## mean of x 
## -3.580415
wilcox.test(maxAll$centroid,data = maxAll,alternative = "less")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  maxAll$centroid
## V = 2097, p-value = 0.09382
## alternative hypothesis: true location is less than 0

 

Most Distal sensation for Threshold threshold

minAll %$% t.test(max, conf.level = 0.95)
## 
##  One Sample t-test
## 
## data:  max
## t = 12.586, df = 98, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  40.02316 55.00714
## sample estimates:
## mean of x 
##  47.51515
wilcox.test(minAll$max,data = minAll,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  minAll$max
## V = 3916, p-value < 2.2e-16
## alternative hypothesis: true location is greater than 0

 

Most Distal sensation for maximum comfortable threshold

maxAll %$% t.test(max, conf.level = 0.95)
## 
##  One Sample t-test
## 
## data:  max
## t = 17.259, df = 98, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  61.21826 77.12517
## sample estimates:
## mean of x 
##  69.17172
wilcox.test(maxAll$max,data = maxAll,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  maxAll$max
## V = 4560, p-value < 2.2e-16
## alternative hypothesis: true location is greater than 0

With a 95% confidence interval, the sensation’s vertical centroid is on average distally located from the active electrode’s center at Threshold threshold, but the results for the vertical centroid at maximum comfortable threshold are not statistically significant. With a 95% confidence interval, the sensation’s distal envelop bound is on average located distally from the center of the active electrode for both the Threshold and maximum comfortable thresholds. Furthermore the previous paired t-test that compared the distal bound of the sensation envelope showed with statistical significance that the bound was more distal for the maximum comfortable threshold. The 95% confidence interval of the average distal bound of the sensations is 61 to 77 pixels, were 50 pixels is approximately one phalange. Therefore, on average the distal bound of the sensation’s envelop is located more than one phalange away from the center of the active electrode when stimulating at maximum comfortable threshold.

 

4.3.2.1 Clinically Significant Results

4.3.2.1.1 Clinically Significant Distally-Refered Average Sensations

Clinically significant observations for the Threshold threshold

total <- nrow(minAll)
minCent50 <- minAll %>% filter(centroid >= 50)
minCent50Count <- nrow(minCent50)

Number of observations with the average vertical centroid distal from the active electrode center by at least one phalange

Total Observations: 99

Clinically Significant Observations: 17

Percentage: 17.1717171717172

 

Clinically significant observations for the maximum comfortable threshold

total <- nrow(maxAll)
maxCent50 <- maxAll %>% filter(centroid >= 50)
maxCent50Count <- nrow(maxCent50)

Number of observations with the average vertical centroid distal from the active electrode center by at least one phalange

Total Observations: 99

Clinically Significant Observations: 9

Percentage: 9.09090909090909

Only 9% of the sensation were in average (vertical centroid) distal from the center of the active electrode by at least one phalange for the maximum comfortable threshold compared to 17% for the Threshold threshold.

 

Table with clinically significant observations For Threshold Threshold

minCent50

 

Table with clinically significant observations For maximum comfortable threshold

maxCent50

Subjects with clinically significant observations at Threshold threshold: 3, 4, 5, 6, 10, 11, 12

Subjects with clinically significant observations at maximum comfortable threshold: 2, 3, 4, 6, 9, 11, 12

Difference: Maximum Comfortable (1, 9) and Threshold threshold (10, 5)

No clear improvement in the number of subjects who had a clinically significant result when comparing Threshold threshold and the maximum comfortable threshold.

 

4.3.2.1.2 Clinically Significant Distally-Refered Most Distal Sensations

Clinically significant observations for the Threshold threshold

total <- nrow(minAll)
minCent50 <- minAll %>% filter(max >= 50)
minCent50Count <- nrow(minCent50)

Number of observations with the distal envelope boundary distally located from the active electrode center by at least one phalange

Total Observations: 99

Clinically Significant Observations: 45

Percentage: 45.4545454545455

 

Clinically significant observations for the maximum comfortable threshold

total <- nrow(maxAll)
maxCent50 <- maxAll %>% filter(max >= 50)
maxCent50Count <- nrow(maxCent50)

Number of observations with the distal envelope boundary distally located from the active electrode center by at least one phalange

Total Observations: 99

Clinically Significant Observations: 70

Percentage: 70.7070707070707

70% of the trials produced distal sensations at least one phalange away from the center of the active electrode for the maximum comfortable threshold compared to 45% for the Threshold threshold.

 

Table with clinically significant observations For Threshold threshold

minCent50

 

Table with clinically significant observations for maximum comfortable threshold

maxCent50

Subjects with clinically significant observations at Threshold threshold: 1, 2, 3, 4, 5, 6, 9, 10, 11, 12

Subjects with clinically significant observations at maximum comfortable threshold: 1, 2, 3, 4, 5, 6, 9, 10, 11, 12

Difference: None, both are missing subject 8

No difference subject wise when comparing clinically significant results for the distal boundary of the sensation envelope

4.3.3 Is There A Statistically Significant Difference In the Vertical Centroid and Envelope of the Sensation Across Different Electrode Locations?

Normality test centroid

p1 <- ggplot(centroidData, aes(x = centroid)) +
    geom_histogram(fill = "slateblue", col = "white", 
                   binwidth = 1) + 
    labs(x = "Centroid") +
    theme_bw()

p2 <- ggplot(centroidData, aes(sample = centroid)) +
    geom_qq(col = "slateblue") + geom_qq_line(col = "red") + 
    labs(y = "Centroid") +
    theme_bw()

p3 <- ggplot(centroidData, aes(x = "", y = centroid)) +
    geom_violin() + 
    geom_boxplot(fill = "slateblue", width = 0.3, notch = TRUE) + 
    labs(y = "Centroid",
         x = "") +
    theme_bw() + 
    coord_flip()

p1 + p2 - p3 +
  plot_layout(ncol = 1, height = c(3, 2))

Two way anova of max sensation threshold average vertical centroid

two.way <- aov(centroid ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value   Pr(>F)    
## ActiveElectrode                  2  53108   26554  23.418 6.48e-09 ***
## ReturnElectrode                  2   2003    1002   0.883    0.417    
## ActiveElectrode:ReturnElectrode  4   2342     585   0.516    0.724    
## Residuals                       90 102051    1134                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(centroid ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(centroid ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  centroid and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of min sensation threshold average vertical centroid

two.wayMin <- aov(centroid ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  20006   10003   4.552 0.0131 *
## ReturnElectrode                  2    742     371   0.169 0.8449  
## ActiveElectrode:ReturnElectrode  4   3247     812   0.369 0.8299  
## Residuals                       90 197790    2198                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(centroid ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(centroid~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  centroid and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of max sensation threshold average most distal sensation

two.way <- aov(max ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value   Pr(>F)    
## ActiveElectrode                  2  26758   13379   9.641 0.000161 ***
## ReturnElectrode                  2   1387     694   0.500 0.608312    
## ActiveElectrode:ReturnElectrode  4   2802     700   0.505 0.732344    
## Residuals                       90 124895    1388                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(max ~ ActiveElectrode *ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(max ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  max and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Pairwise comparison using paired Wilcoxon signed-rank test

pwc <- maxFried%>%wilcox_test(max ~ ActiveElectrode, p.adjust.method = "bonferroni")
pwc

Two way anova of min sensation threshold average most distal sensation

two.wayMin <- aov(max ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value   Pr(>F)    
## ActiveElectrode                  2  20910   10455   8.194 0.000538 ***
## ReturnElectrode                  2    233     116   0.091 0.912981    
## ActiveElectrode:ReturnElectrode  4   2313     578   0.453 0.769809    
## Residuals                       90 114828    1276                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(max ~ ActiveElectrode *ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(max~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  max and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 6, df = 2, p-value = 0.04979

Pairwise comparison using paired Wilcoxon signed-rank test

pwc <- minFried%>%wilcox_test(max ~ ActiveElectrode, p.adjust.method = "bonferroni")
pwc

Tukey test to compare active and return electrode categories in min threshold

TukeyHSD(two.wayMin)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = max ~ ActiveElectrode * ReturnElectrode, data = minAll)
## 
## $ActiveElectrode
##           diff        lwr      upr     p adj
## IL-IA -7.00000 -27.955715 13.95572 0.7064134
## PL-IA 26.72727   5.771557 47.68299 0.0086339
## PL-IL 33.72727  12.771557 54.68299 0.0006741
## 
## $ReturnElectrode
##               diff       lwr      upr     p adj
## PA1-Elb  3.4545455 -17.50117 24.41026 0.9185304
## PP1-Elb  3.0000000 -17.95572 23.95572 0.9379033
## PP1-PA1 -0.4545455 -21.41026 20.50117 0.9985280
## 
## $`ActiveElectrode:ReturnElectrode`
##                     diff         lwr      upr     p adj
## IL:Elb-IA:Elb  -8.272727 -56.6845565 40.13910 0.9997948
## PL:Elb-IA:Elb  39.909091  -8.5027384 88.32092 0.1930142
## IA:PA1-IA:Elb   8.090909 -40.3209202 56.50274 0.9998263
## IL:PA1-IA:Elb   1.909091 -46.5027384 50.32092 1.0000000
## PL:PA1-IA:Elb  32.000000 -16.4118293 80.41183 0.4792445
## IA:PP1-IA:Elb  10.272727 -38.1391020 58.68456 0.9989885
## IL:PP1-IA:Elb   3.727273 -44.6845565 52.13910 0.9999996
## PL:PP1-IA:Elb  26.636364 -21.7754656 75.04819 0.7147817
## PL:Elb-IL:Elb  48.181818  -0.2300111 96.59365 0.0520915
## IA:PA1-IL:Elb  16.363636 -32.0481929 64.77547 0.9764648
## IL:PA1-IL:Elb  10.181818 -38.2300111 58.59365 0.9990515
## PL:PA1-IL:Elb  40.272727  -8.1391020 88.68456 0.1835334
## IA:PP1-IL:Elb  18.545455 -29.8663747 66.95728 0.9505569
## IL:PP1-IL:Elb  12.000000 -36.4118293 60.41183 0.9969519
## PL:PP1-IL:Elb  34.909091 -13.5027384 83.32092 0.3580060
## IA:PA1-PL:Elb -31.818182 -80.2300111 16.59365 0.4872180
## IL:PA1-PL:Elb -38.000000 -86.4118293 10.41183 0.2484827
## PL:PA1-PL:Elb  -7.909091 -56.3209202 40.50274 0.9998536
## IA:PP1-PL:Elb -29.636364 -78.0481929 18.77547 0.5844083
## IL:PP1-PL:Elb -36.181818 -84.5936475 12.23001 0.3101059
## PL:PP1-PL:Elb -13.272727 -61.6845565 35.13910 0.9939181
## IL:PA1-IA:PA1  -6.181818 -54.5936475 42.23001 0.9999777
## PL:PA1-IA:PA1  23.909091 -24.5027384 72.32092 0.8183573
## IA:PP1-IA:PA1   2.181818 -46.2300111 50.59365 1.0000000
## IL:PP1-IA:PA1  -4.363636 -52.7754656 44.04819 0.9999985
## PL:PP1-IA:PA1  18.545455 -29.8663747 66.95728 0.9505569
## PL:PA1-IL:PA1  30.090909 -18.3209202 78.50274 0.5640647
## IA:PP1-IL:PA1   8.363636 -40.0481929 56.77547 0.9997773
## IL:PP1-IL:PA1   1.818182 -46.5936475 50.23001 1.0000000
## PL:PP1-IL:PA1  24.727273 -23.6845565 73.13910 0.7894314
## IA:PP1-PL:PA1 -21.727273 -70.1391020 26.68456 0.8845961
## IL:PP1-PL:PA1 -28.272727 -76.6845565 20.13910 0.6449054
## PL:PP1-PL:PA1  -5.363636 -53.7754656 43.04819 0.9999926
## IL:PP1-IA:PP1  -6.545455 -54.9572838 41.86637 0.9999653
## PL:PP1-IA:PP1  16.363636 -32.0481929 64.77547 0.9764648
## PL:PP1-IL:PP1  22.909091 -25.5027384 71.32092 0.8507764

Two way anova of max sensation threshold average most proximal sensation

two.way <- aov(min ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value   Pr(>F)    
## ActiveElectrode                  2  95342   47671  26.920 6.86e-10 ***
## ReturnElectrode                  2   8748    4374   2.470   0.0903 .  
## ActiveElectrode:ReturnElectrode  4   3630     908   0.513   0.7267    
## Residuals                       90 159374    1771                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(min ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(min ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  min and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of min sensation threshold average most proximal sensation

two.wayMin <- aov(min ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)
## ActiveElectrode                  2  12938    6469   1.795  0.172
## ReturnElectrode                  2   1068     534   0.148  0.863
## ActiveElectrode:ReturnElectrode  4   4957    1239   0.344  0.848
## Residuals                       90 324391    3604
minFried <- aggregate(min ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(min~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  min and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 2.6667, df = 2, p-value = 0.2636

 

4.3.4 Centroid and Envelope of the Most Intense Sensation Reported in Each Trial

centroidData <- read_csv("centroid_dataMaxSensation.csv")%>%
  clean_names() %>% 
  #filter(subject %in% c("01", "02", "03", "04", "10", "11", "12")) %>%
  mutate(location = factor(location)) %>%
  mutate(temp1 = case_when(
        strenght == 2 ~ "Maximum Comfortable",
        strenght == 1 ~ "Threshold"),
        strenghtCAT = factor(temp1)) %>%
  mutate(temp2 = case_when(
        location == 1 ~ "PL|PA1",
        location == 2 ~ "IL|PA1",
        location == 3 ~ "IA|PA1",
        location == 4 ~ "PL|Elb",
        location == 5 ~ "IL|Elb",
        location == 6 ~ "IA|Elb",
        location == 7 ~ "PL|PP1",
        location == 8 ~ "IL|PP1",
        location == 9 ~ "IA|PP1"),
        locationCAT = factor(temp2)) %>%
  mutate(temp3 = case_when(
        location == 1 ~ "PL",
        location == 2 ~ "IL",
        location == 3 ~ "IA",
        location == 4 ~ "PL",
        location == 5 ~ "IL",
        location == 6 ~ "IA",
        location == 7 ~ "PL",
        location == 8 ~ "IL",
        location == 9 ~ "IA"),
        ActiveElectrode = factor(temp3)) %>%
  mutate(temp4 = case_when(
        location == 1 ~ "PA1",
        location == 2 ~ "PA1",
        location == 3 ~ "PA1",
        location == 4 ~ "Elb",
        location == 5 ~ "Elb",
        location == 6 ~ "Elb",
        location == 7 ~ "PP1",
        location == 8 ~ "PP1",
        location == 9 ~ "PP1"),
        ReturnElectrode = factor(temp4)) %>%
  select(locationCAT, strenghtCAT, centroid, subject, ReturnElectrode, ActiveElectrode, min, max);
centroidData.summary <- centroidData %>%
    group_by(locationCAT, strenghtCAT) %>%
    summarise (
      aveMin= mean(min),
      aveMax = mean(max),
      aveCentroid = mean(centroid),
    )
  centroidData %>%
    ggplot() +
    geom_linerange(data = centroidData.summary, mapping = aes(x=locationCAT, ymin= aveMin, ymax=aveMax, color = factor(strenghtCAT, levels =c('Threshold', 'Maximum Comfortable'))),  position = position_dodge(width=1), size =4)+
    geom_linerange(data = centroidData.summary, mapping = aes(x=locationCAT, ymin= aveCentroid-1, ymax=aveCentroid+1, group= factor(strenghtCAT, levels =c('Threshold', 'Maximum Comfortable'))),position =position_dodge(width=1), size =4)+
    labs(title = "Vertical Centroid and Envelop for the Maximum Intensity Sensation \n in each Trial with the same Reference Point for all Electrode Combinations",
         y = " vertical Centroid and Envelope (px)",
         x = "Location",
         caption = "0px is center of proximal phalange",
          color = "Strenght") +
    scale_color_manual(values = c("#4C46FF", "#FF3939"))+
    theme_classic();

From Threshold to maximum comfortable threshold, the average vertical centroid becomes more proximal, the envelope expands, and the average proximal and distal envelope boundaries become more proximal and distal respectively across all locations.

 

4.3.5 Does Sensation Become more Distal as Stimualtion Strenght is Increased?

Vertical Centroid (in average)

minSel <- centroidData %>% filter(strenghtCAT == "Threshold") %>% select(centroid);
maxSel <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable") %>% select(centroid);
minAll <- centroidData %>% filter(strenghtCAT == "Threshold");
maxAll <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable");
centroidData %$% t.test(centroid ~ strenghtCAT, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  centroid by strenghtCAT
## t = -3.5628, df = 98, p-value = 0.0005686
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -27.449764  -7.810117
## sample estimates:
## mean of the differences 
##               -17.62994
wilcox.test(centroid ~ strenghtCAT,data = centroidData,paired = TRUE,alternative = "less")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  centroid by strenghtCAT
## V = 1603, p-value = 0.001176
## alternative hypothesis: true location shift is less than 0

With 95% confidence, the average vertical centroid of the most intense sensation is more distal for the Threshold threshold that for the maximum comfortable threshold.

 

Most Distal Sensation

minSel <- centroidData %>% filter(strenghtCAT == "Threshold") %>% select(max);
maxSel <- centroidData %>% filter(strenghtCAT == "Maximum Comfortable") %>% select(max);
centroidData %$% t.test(max ~ strenghtCAT, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  max by strenghtCAT
## t = 3.978, df = 98, p-value = 0.0001332
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   9.192589 27.494279
## sample estimates:
## mean of the differences 
##                18.34343
wilcox.test(max ~ strenghtCAT,data = centroidData,paired = TRUE,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  max by strenghtCAT
## V = 3368.5, p-value = 2.682e-05
## alternative hypothesis: true location shift is greater than 0

With 95% confidence, the most distal highest intensity sensation is more distal for the maximum comfortable threshold than for the Threshold threshold.

 

4.3.5.1 Clinically Significant Diference in Most Distal Sensation Between Threshold Threshold and Maximum Comfortable Threshold

Total number observations where the difference for the distal envelop boundary between the Threshold threshold and the maximum comfortable threshold is more than one phalange

diff = maxSel-minSel
total <- nrow(diff)
diff <- diff %>% filter(diff >= 50)
sig <- nrow(diff)

Total Observations: 99

Significant Observations: 22

Percentage: 22.2222222222222

22% of the trials had the most distal highest intensity sensation move distally by at least one phalange when increasing the stimulation parameters from the Threshold threshold to the maximum comfortable threshold.

 

4.3.5.2 How Many More Subjects had Clinically Significant Distal Sensations When Comparing Sensation Locations at Threshold Threshold and Maximum Comfortable Threshold

minAll75 <- minAll %>% filter(max >= 75)
sigMin <- nrow(minAll75)
maxAll75 <- maxAll %>% filter(max >= 75)
sigMax <- nrow(maxAll75)

Number of observations that generated a sensation in the distal phalange:

Threshold threshold clinically significant trials: 59

Maximum comfortable threshold clinically significant trials: 74

Difference:15

15 more observation reported a maximum intensity sensation for the maximum comfortable threshold than for the Threshold threshold.

Table with clinically significant observations for Threshold threshold

minAll75

 

Table with clinically significant observations For maximum comfortable threshold

maxAll75

Subjects with clinically significant observations at Threshold threshold:All

Subjects with clinically significant observations at maximum comfortable threshold: All

Difference: None

All subjects reported a maximum intensity sensation in the distal phalange at both the Threshold threshold and the maximum comfortable threshold.

 

4.3.5.3 Does the Sensation Envelop Size Increase as Stimualtion Strenght is Increased?

centroidData %$% t.test(max-min ~ strenghtCAT, paired = TRUE, conf.level = 0.95)
## 
##  Paired t-test
## 
## data:  max - min by strenghtCAT
## t = 11.302, df = 98, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  54.25294 77.36322
## sample estimates:
## mean of the differences 
##                65.80808
wilcox.test(max-min ~ strenghtCAT,data = centroidData,paired = TRUE,alternative = "greater")
## 
##  Wilcoxon signed rank test with continuity correction
## 
## data:  max - min by strenghtCAT
## V = 4676.5, p-value = 7.804e-15
## alternative hypothesis: true location shift is greater than 0

With statistical significance, the envelop size increase as stimulation strength increases for the maximum intensity sensation by an average of 65px or 1.3 phalanges.

 

4.3.6 Is There A Statistically Significant Difference In the Centroid and Envelope of the Sensation Across Different Electrode Locations for the Most Instense Sensation Only?

Two way anova of max sensation threshold average vertical centroid

two.way <- aov(centroid ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value Pr(>F)
## ActiveElectrode                  2   1485   742.6   0.646  0.526
## ReturnElectrode                  2   2633  1316.5   1.145  0.323
## ActiveElectrode:ReturnElectrode  4   1396   348.9   0.304  0.875
## Residuals                       90 103442  1149.4
maxFried <- aggregate(centroid ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(centroid ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  centroid and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 0.66667, df = 2, p-value = 0.7165

Two way anova of min sensation threshold average vertical centroid

two.wayMin <- aov(centroid ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  14425    7213   3.312  0.041 *
## ReturnElectrode                  2   1329     664   0.305  0.738  
## ActiveElectrode:ReturnElectrode  4   2451     613   0.281  0.889  
## Residuals                       90 196021    2178                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(centroid ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(centroid ~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  centroid and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of max sensation threshold average most distal sensation

two.way <- aov(max ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2   8201    4101   2.790 0.0667 .
## ReturnElectrode                  2   2407    1204   0.819 0.4441  
## ActiveElectrode:ReturnElectrode  4   2136     534   0.363 0.8342  
## Residuals                       90 132279    1470                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(max ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(max ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  max and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of min sensation threshold average most distal sensation

two.wayMin <- aov(max ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  10931    5465   3.522 0.0337 *
## ReturnElectrode                  2    425     212   0.137 0.8723  
## ActiveElectrode:ReturnElectrode  4   2455     614   0.395 0.8114  
## Residuals                       90 139656    1552                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(max ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(max ~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  max and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 6, df = 2, p-value = 0.04979

Tukey test to compare active and return electrode categories in min sensation threshold

TukeyHSD(two.wayMin)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = max ~ ActiveElectrode * ReturnElectrode, data = minAll)
## 
## $ActiveElectrode
##             diff       lwr       upr     p adj
## IL-IA  -9.424242 -32.53470 13.686213 0.5965060
## PL-IA -25.454545 -48.56500 -2.344090 0.0272529
## PL-IL -16.030303 -39.14076  7.080153 0.2290601
## 
## $ReturnElectrode
##              diff       lwr      upr     p adj
## PA1-Elb  5.030303 -18.08015 28.14076 0.8624193
## PP1-Elb  3.090909 -20.01955 26.20136 0.9455759
## PP1-PA1 -1.939394 -25.04985 21.17106 0.9781984
## 
## $`ActiveElectrode:ReturnElectrode`
##                      diff       lwr      upr     p adj
## IL:Elb-IA:Elb -10.0909091 -63.48061 43.29880 0.9995657
## PL:Elb-IA:Elb -11.1818182 -64.57152 42.20789 0.9990798
## IA:PA1-IA:Elb  10.7272727 -42.66243 64.11698 0.9993196
## IL:PA1-IA:Elb   2.0909091 -51.29880 55.48061 1.0000000
## PL:PA1-IA:Elb -19.0000000 -72.38970 34.38970 0.9678359
## IA:PP1-IA:Elb  11.0000000 -42.38970 64.38970 0.9991830
## IL:PP1-IA:Elb   1.4545455 -51.93516 54.84425 1.0000000
## PL:PP1-IA:Elb -24.4545455 -77.84425 28.93516 0.8723882
## PL:Elb-IL:Elb  -1.0909091 -54.48061 52.29880 1.0000000
## IA:PA1-IL:Elb  20.8181818 -32.57152 74.20789 0.9453392
## IL:PA1-IL:Elb  12.1818182 -41.20789 65.57152 0.9982982
## PL:PA1-IL:Elb  -8.9090909 -62.29880 44.48061 0.9998283
## IA:PP1-IL:Elb  21.0909091 -32.29880 74.48061 0.9412094
## IL:PP1-IL:Elb  11.5454545 -41.84425 64.93516 0.9988406
## PL:PP1-IL:Elb -14.3636364 -67.75334 39.02607 0.9946474
## IA:PA1-PL:Elb  21.9090909 -31.48061 75.29880 0.9275537
## IL:PA1-PL:Elb  13.2727273 -40.11698 66.66243 0.9968891
## PL:PA1-PL:Elb  -7.8181818 -61.20789 45.57152 0.9999361
## IA:PP1-PL:Elb  22.1818182 -31.20789 75.57152 0.9225697
## IL:PP1-PL:Elb  12.6363636 -40.75334 66.02607 0.9977944
## PL:PP1-PL:Elb -13.2727273 -66.66243 40.11698 0.9968891
## IL:PA1-IA:PA1  -8.6363636 -62.02607 44.75334 0.9998641
## PL:PA1-IA:PA1 -29.7272727 -83.11698 23.66243 0.7014920
## IA:PP1-IA:PA1   0.2727273 -53.11698 53.66243 1.0000000
## IL:PP1-IA:PA1  -9.2727273 -62.66243 44.11698 0.9997683
## PL:PP1-IA:PA1 -35.1818182 -88.57152 18.20789 0.4835564
## PL:PA1-IL:PA1 -21.0909091 -74.48061 32.29880 0.9412094
## IA:PP1-IL:PA1   8.9090909 -44.48061 62.29880 0.9998283
## IL:PP1-IL:PA1  -0.6363636 -54.02607 52.75334 1.0000000
## PL:PP1-IL:PA1 -26.5454545 -79.93516 26.84425 0.8128172
## IA:PP1-PL:PA1  30.0000000 -23.38970 83.38970 0.6910687
## IL:PP1-PL:PA1  20.4545455 -32.93516 73.84425 0.9505269
## PL:PP1-PL:PA1  -5.4545455 -58.84425 47.93516 0.9999960
## IL:PP1-IA:PP1  -9.5454545 -62.93516 43.84425 0.9997123
## PL:PP1-IA:PP1 -35.4545455 -88.84425 17.93516 0.4727402
## PL:PP1-IL:PP1 -25.9090909 -79.29880 27.48061 0.8322406

Two way anova of max sensation threshold average most proximal sensation

two.way <- aov(min ~ ActiveElectrode * ReturnElectrode, data = maxAll)
summary(two.way)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2   2641    1321   0.800 0.4524  
## ReturnElectrode                  2  11829    5915   3.584 0.0318 *
## ActiveElectrode:ReturnElectrode  4   3138     784   0.475 0.7537  
## Residuals                       90 148523    1650                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maxFried <- aggregate(min ~ ActiveElectrode +ReturnElectrode, data= maxAll, mean)
resFried <-friedman.test(min ~ ActiveElectrode |ReturnElectrode, data = maxFried)
resFried
## 
##  Friedman rank sum test
## 
## data:  min and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

Two way anova of min sensation threshold average most proximal sensation

two.wayMin <- aov(min ~ ActiveElectrode * ReturnElectrode, data = minAll)
summary(two.wayMin)
##                                 Df Sum Sq Mean Sq F value Pr(>F)  
## ActiveElectrode                  2  28085   14042   3.880 0.0242 *
## ReturnElectrode                  2    985     493   0.136 0.8729  
## ActiveElectrode:ReturnElectrode  4   4884    1221   0.337 0.8522  
## Residuals                       90 325764    3620                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
minFried <- aggregate(min ~ ActiveElectrode +ReturnElectrode, data= minAll, mean)
resFriedMin <-friedman.test(min~ ActiveElectrode |ReturnElectrode, data = minFried)
resFriedMin
## 
##  Friedman rank sum test
## 
## data:  min and ActiveElectrode and ReturnElectrode
## Friedman chi-squared = 4.6667, df = 2, p-value = 0.09697

The electrode locations did not have statistically significant results on any of the outcomes, but the comparison of the return electrodes for the most proximal highest intensity sensation had the most significant outcome. The TukeyHSD analysis return p values of 0.053 and 0.1 when comparing the elbow electrode to the anterior and posterior palm electrodes respectively. On average the elbow produced a more distal proximal envelop bound when compared to the other two return electrodes.